<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/common/default.jsp"%>
<html>
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine.js"></script>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine-cn.js"></script>
	</head>
	

	<body>
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
	
			<ul class="breadcrumb">
				<li><i class="icon-home home-icon"></i> <a href="#">首页</a></li>
				<li>用户中心</li>
				<li class="active">学员管理</li>
			</ul>
			<!-- .breadcrumb -->
		</div>	
		
		<div class="page-content">
			<div class="page-header">
				<h1>学员管理
					<small>
					<i class="icon-double-angle-right"></i>
					查看
					</small>					
				</h1>			
			</div>
			<div>
				<form  id="searchStudentForm" name="searchStudentForm" role="form" method="post" action="${ctx}/sys/tstudent/list">
					<input type="text" id="name" name="name" placeholder="姓名" value="${searchStudentForm.name}" class="col-xs-10 col-sm-2"/>
					<label for="form-field-select-3" style="width:40px;margin-left: 20px" for="gradeId">年级 </label>
					<select  id="gradeId" name="gradeId" data-placeholder="请选择年级">
						<option value="">请选择年级</option>
						<option value="1"  <c:if test="${searchStudentForm.gradeId eq '1'}">selected</c:if> >预初</option>
						<option value="2" <c:if test="${searchStudentForm.gradeId eq '2'}">selected</c:if> >初一</option>
						<option value="3" <c:if test="${searchStudentForm.gradeId eq '3'}">selected</c:if> >初二</option>
						<option value="4" <c:if test="${searchStudentForm.gradeId eq '4'}">selected</c:if> >初三</option>
					</select>
					
					<!--<label for="form-field-select-3" style="width:60px;margin-left: 20px" for="orderCode">开始时间 </label>
					<div class="input-group">
					<input class="form-control date-picker" id="id-date-picker-1" type="text" data-date-format="yyyy-mm-dd" />
					<span class="input-group-addon">
																		<i class="icon-calendar bigger-110"></i>
																	</span>  -->
					<input id="sysUserInfoSearch" type="submit" value="查询" style="margin-left: 10px">
					
				</form>				
			</div>
				
			<div style="line-height: 10px;">&nbsp;</div> 
		
			<div class="row" >	
			<div class="col-xs-12">
				<table id="simple-table" class="table table-striped table-bordered table-hover"  style="margin-top:5px;">
							<thead>
								<tr>
									<th class="center" style="width: 30px;">
										<label><input class="ace" type="checkbox" id="zcheckbox" /><span class="lbl"></span></label>
									</th>
									<th class='center' style="width:50px;">序号</th>

									<th class="center">姓名</th>
									<th class="center">家长姓名</th>
									<th class="center">性别</th>
									<th class="center">手机号码</th>
									<th class="center">邮箱</th>
									<th class="center">注册时间</th>
									<th class="center">学校</th>
									<th class="center">年级</th>
									<th class="center">班级</th>
									<th class="center">状态</th>
									<th class="center" >操作</th>

								</tr>
							</thead>
												
							<tbody id="userlist">
							<c:forEach var="res" items="${res.data.rows}" varStatus="status">
							<tr id="userinfo_row_${res.id}" >
								<td class="center">
									<label><input type="checkbox" class="ace" /><span class="lbl"></span></label>
								</td>	
								<td class='center' >${status.index+1}</td>  							
								<td class="center">&nbsp;<a style="margin-left: 3%;" href="${ctx}/sys/tstudent/toUpdate/${res.id}" title="">${res.name}</a></td>
								<td class="center">&nbsp;<a style="margin-left: 3%;" title="">${res.parentName}</a></td>
								<td class="center" title="${res.sex}">&nbsp;
								<c:choose>
				                 	<c:when test="${res.sex==1}">男</c:when>
				                 	<c:otherwise>女</c:otherwise>
				                 </c:choose>
				                 </td>
								 <td class="center" title="${res.phone}">&nbsp;${res.phone}</td>
								 <td class="center" title="${res.email}">&nbsp;${res.email}</td>
								 <td class="center" title="${res.createTime}">&nbsp;<fmt:formatDate value="${res.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
								 <td class="center" title="${res.schoolId}">&nbsp;${res.schoolName}</td>
								 <td class="center" title="${res.gradeId}">&nbsp;${res.gardeName}</td>
								 <td class="center" title="${res.classId}">&nbsp;${res.className}</td>
								 <td class="center">
										<c:choose>
					                 		<c:when test="${res.status==0}">未审批</c:when>
					                 		<c:otherwise>已审批</c:otherwise>
					                 	</c:choose>
									</td>
				                 <td class="center">
				                 	<button title="编辑" class="btn btn-xs btn-info" onclick="location='${ctx}/sys/tstudent/toUpdate/${res.id}'">
										<i class="icon-edit bigger-120"></i>
									</button>
<%-- 				                 	<c:choose> --%>
<%-- 					                 		<c:when test="${res.status==0}"><i onclick="javascript:examine(${res.id})" title="审批" class="icon-flag"></i></c:when> --%>
<%-- 					                 </c:choose> --%>
								</td>
							</tr> 
							</c:forEach>
							</tbody>
				</table>
				<div style="margin-bottom: 20px">
					<a class="btn btn-sm btn-success" href="${ctx}/sys/tstudent/toAdd">新增</a>
				</div>	
				
				<%@ include file="/WEB-INF/views/decorators/page.jsp"%> 	 
			</div>
			</div>
			
			
		</div>
		<script type="text/javascript">
			jQuery(function($) {
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
				
				/* $('.date-picker').datepicker({autoclose:true}).next().on(ace.click_event, function(){
					$(this).prev().focus();
				}); */
			})
			function examine(stuid){
				var data = new Object();
				data.stuid = stuid;
				 $.ajax({
				        async: true,
				        type:"POST",
				        data:data,
				        url: "${ctx}/sys/tstudent/examine",
				        dataType: "json",
				        success: function (data) {
				    	    if("success" == data.result){//成功
				    	    	alert("审批成功");
				    	    	window.location.href = "${ctx}/sys/tstudent/list";
				    	    }else{//失败
				    	    	alert("审批失败");
				    	    }
				        }
					},"json");
			}
		
		</script>
	</body>

</html>
